package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const ENTER_STR string = "enter your cmd: "

var colourMap map[byte]byte = map[byte]byte{0: 40, 1: 42, 2: 41, 3: 41, 4: 41, 5: 41, 6: 43, 7: 43, 8: 44, 9: 44}

var in = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, 2500000, 2500000)
	in.Buffer(buf, 0)
}

func nextString() string {
	in.Scan()
	return in.Text()
}

var cmd string
var x, y int
var action string

func parseCmd(cmd string) bool {
	items := strings.Split(cmd, " ")
	if len(items) == 0 {
		return false
	}
	if len(items) == 1 {
		switch items[0] {
		case "save", "load", "cheat", "exit":
			action = items[0]
			return true
		}
		return false
	}
	var err error
	x, err = strconv.Atoi(items[0])
	if err != nil {
		return false
	}
	y, err = strconv.Atoi(items[1])
	if err != nil {
		return false
	}
	action = items[2]
	return true
}

func cleanCmd(i int) {
	fmt.Printf("\033[%dA\r\033[%dC\033[K", i, len(ENTER_STR))
}
